Multiple clients over singele TCP/IP connection
От | M. Bastin |
---|---|
Тема | Multiple clients over singele TCP/IP connection |
Дата | |
Msg-id | a06110403bd1d6f46b8c9@[213.119.79.138] обсуждение исходный текст |
Ответ на | Re: concurrent cursors possible with portals? (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-novice |
This is a "best practice" question. Imagine you have 2 computers. One is a web server and the other runs PostgreSQL. Multiple browsers from all over the net connect to the web server, but to minimize load, the web server itself opens only 1 TCP/IP connection with PostgreSQL. (This is a general question, it doesn't have to be a web server. It could be any kind of "middleman".) How would all the browsers be best served simultaneously? The solution I think about is to use the extended query protocol, open an infinitely lasting transaction, and have a portal per browser. That would work to read data until an error occurs and the transaction would roll back and then *all* browsers' sessions would have to be reset. (Therefore to write data I'd have to cheat and still open a second TCP/IP connection over which each insert or update gets committed instantly.) Is there a better way to implement concurrent users over 1 single TCP/IP session? Thanks, Marc At 1:34 PM -0400 7/1/04, Tom Lane wrote: > > The only thing that bothers me is the Sync command that would put an >> end to all portals at once isn't it? > >Not if you are inside a transaction block (ie, have issued a BEGIN >command). > >A possibly more serious issue is that an error detected in any one of >the portals aborts the transaction and thus you lose all the portals. >We may eventually have a solution for that involving subtransactions. > > regards, tom lane
В списке pgsql-novice по дате отправления: